﻿using ParkSaleForAdmin.Data;
using ParkSaleForAdmin.Foundation;

namespace ParkSaleForAdmin.FunctionWindow
{
    class LocationInfo
    {
        [DataToUI("小区名称", "name")]
        public string Name
        {
            get;
            set;
        }
        [DataToUI("小区地址", "Address")]
        public string Address
        {
            get;
            set;
        }
        [DataToUI("小区归属企业代号", "belong")]
        public string Belong
        {
            get;
            set;
        }
        [DataToUI("小区代号", "id", false)]
        public string ID
        {
            get;
            set;
        }

        //public LocationInfo Parse(DatabaseData data)
        //{
        //    ID = int.Parse(data["id"].Value);
        //    Name = data["name"].Value;
        //    Address = data["address"].Value;
        //    Belong = int.Parse(data["belong"].Value);
        //    return this;
        //}
    }
    class LocationWindow : BasicManagerWindow<LocationInfo>
    {
        public override string TableName => "Location";

        // protected override string[] values => new string[] { "id", "name", "address", "belong" };

        //protected override string[] titles => new string[] { "小区代号", "小区名称", "小区地址", "小区归属企业代号" };

        //protected override string[] InputBoxTitle => new string[] { "小区名称", "小区地址", "小区归属企业代号" };

        //protected override string[] InputBoxValue => new string[] { "name", "address", "belong" };

        //protected override string[] BindingName => new string[] { "ID", "Name", "Address", "Belong" };

        public LocationWindow()
        {
            Title = "小区管理";
        }
        public override string DeleteStr(LocationInfo obj)
        {
            return SQLHelpler.MakeSelectStr(TableName, "id", obj.ID);
        }

        public override string AppendStr(LocationInfo obj)
        {
            return SQLHelpler.MakeSelectStr(TableName, "id", "9999999999");
        }

        public override string ChangeStr(LocationInfo obj)
        {
            return SQLHelpler.MakeSelectStr(TableName, "id", obj.ID);
        }
    }
}
